#!/usr/bin/ruby

require 'fileutils'

exit unless File.directory?("./libpng-apng/") && Dir.entries('./libpng-apng/').include?("png.c")

files = ["png.c", "pngdebug.h", "pngerror.c", "pngget.c", "pnginfo.h", "pngmem.c", "pngpread.c", "pngpriv.h", "pngread.c", "pngrio.c", "pngrtran.c", "pngrutil.c", "pngset.c", "pngstruct.h", "pngtrans.c", "pngwio.c", "pngwrite.c", "pngwtran.c", "pngwutil.c", "arm/filter_neon_intrinsics.c", "arm/filter_neon.S", "arm/arm_init.c"]
files.map! { |file| "./libpng-apng/" + file}

include_files = ["pngconf.h", "png.h"]
include_files.map! { |file| "./libpng-apng/" + file}

FileUtils.mkdir_p './APNGKit/libpng-apng/include'

FileUtils.cp files, './APNGKit/libpng-apng'
FileUtils.cp include_files, './APNGKit/libpng-apng/include'

FileUtils.cp './libpng-apng/scripts/pnglibconf.h.prebuilt', './APNGKit/libpng-apng/include/pnglibconf.h'
